package com.ruoyi.system.api.factory;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.RemoteStaffService;
import com.ruoyi.system.api.domain.SysStaff;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author sft
 * @description 员工档案服务降级
 * @date 2022/11/14
 */
public class RemoteStaffFallbackFactory implements FallbackFactory<RemoteStaffService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteStaffFallbackFactory.class);

    @Override
    public RemoteStaffService create(Throwable throwable) {
        log.error("员工档案服务调用失败:{}", throwable.getMessage());
        return new RemoteStaffService() {
            @GetMapping("/staff/list1")
            @Override
            public AjaxResult findStaffList(SysStaff sysStaff) {
                return null;
            }
        };
    }
}
